<?php
/**
 *
 * PHP API CP 3.15活动 优惠券发放 控制器
 * @author jeff liu
 * powered by jeff liu 2012-02-29
 */

include API_ROOT_PATH . '/app/single_user_send_coupon_base.app.php';

class Cp315_send_couponApp extends Single_user_send_coupon_baseApp
{
    /**
     * 是否可以向同一用户重复发放优惠券
     * @var boolean
     */
    public $duplicate = false;

    /**
     *
     * 活动状态
     * @var boolean
     */
    public $hd_status = true;

    /**
     * 记录log对应的model
     * @var object
     */
    public $log_model = null;

    function __construct()
    {
        $this->Cp315_send_couponApp();
    }

    function Cp315_send_couponApp()
    {
        parent::__construct();
    }


    function init()
    {
        $this->log_model =& api_model('cp315_send_coupon_log_single_user');

        $this->template = array(
            //站内信配置
            'message_template' => array(
                'send' => true, //是否发送
                'template' => "tobuyer_cp315_get_coupon_notify", //发送模板(data部分)
                'header_template' => 'tobuyer_cp315_get_coupon_header_notify', //发送模板(站内信头部分)
                'footer_template' => 'tobuyer_cp315_get_coupon_footer_notify', //发送模板(站内信尾部分)
            ),
            //邮件配置
            'mail_template' => array(
                'send' => false, //是否发送
                'template' => "tobuyer_cp315_get_coupon_notify", //发送模板
                'header_template' => 'tobuyer_cp315_get_coupon_header_notify', //发送模板(站内信头部分)
                'footer_template' => 'tobuyer_cp315_get_coupon_footer_notify', //发送模板(站内信尾部分)
            ),
            //手机短信配置
            'mobile_message_template' => array(
                'send' => false, //是否发送
                'template' => "tobuyer_cp315_get_coupon_notify", //发送模板
                'header_template' => 'tobuyer_cp315_get_coupon_header_notify', //发送模板(站内信头部分)
                'footer_template' => 'tobuyer_cp315_get_coupon_footer_notify', //发送模板(站内信尾部分)
            ),
        );
    }

    /**
     * 获得优惠券id
     * @author jeff liu 2012-02-29
     */
    function get_coupon_ids()
    {
        $coupon_ids = array();

        if (file_exists(API_ROOT_PATH . '/data/cp315_coupon_id.inc.php')) {
            $coupon_ids = include API_ROOT_PATH . '/data/cp315_coupon_id.inc.php';
        }
        return $coupon_ids;
    }

}
